package com.lc.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lc.exception.BusinessException;
import com.lc.mapper.PmsBrandMapper;
import com.lc.pojo.PmsBrand;
import com.lc.result.ResultEnum;
import com.lc.service.PmsBrandService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PmsBrandServiceImpl extends ServiceImpl<PmsBrandMapper, PmsBrand> implements PmsBrandService {

    @Resource
    private PmsBrandMapper pmsBrandMapper;

    @Override
    public List<PmsBrand> getBrandList() {
        LambdaQueryWrapper<PmsBrand> wrapper = new LambdaQueryWrapper<>();
        wrapper.orderByAsc(PmsBrand::getFirstLetter);
        List<PmsBrand> list = pmsBrandMapper.selectList(wrapper);
        if(list == null ){
            throw new BusinessException(ResultEnum.COMMON_EXCEPTION);
        }
        return list;
    }

}
